list1 = list(map(int, input().split()))[1:]
list_o = [i for i in list1 if i % 2 == 0]
result_put = []
count = 0
for i in list1:
    if i % 2 != 0:
        result_put.append(i)
        count += 1
        if count == 2 and len(list_o) != 0:
            result_put.append(list_o.pop(0))
            count = 0
while len(list_o) != 0:
    result_put.append(list_o.pop(0))

for i in range(len(result_put)):
    if len(result_put)-1 != i:
        print(f'{result_put[i]}',end=' ')
    else:
        print(f'{result_put[i]}')
